import { safeDiv } from '@/util'
const columnForNum = [
  {
    title: '实际销量',
    dataIndex: 'saleCount',
    width: 150,
    sorter: (a, b) => a.saleCount - b.saleCount
  },
  {
    title: '核销量',
    dataIndex: 'completeCount',
    width: 150,
    sorter: (a, b) => a.completeCount - b.completeCount
  },
  {
    title: '退款量',
    dataIndex: 'refundCount',
    width: 150,
    sorter: (a, b) => a.refundCount - b.refundCount
  }
]
const columnForMoney1 = [
  {
    title: '抖音GMV',
    dataIndex: 'totalWater',
    width: 150,
    sorter: (a, b) => a.totalWater - b.totalWater,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  },
  {
    title: '核销流水',
    dataIndex: 'completeWater',
    width: 150,
    sorter: (a, b) => a.completeWater - b.completeWater,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  },
  {
    title: '退款流水',
    dataIndex: 'refundWater',
    width: 150,
    sorter: (a, b) => a.refundWater - b.refundWater,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  }
]
const columnForMoney2 = [
  {
    title: 'CPS',
    dataIndex: 'cpsMoney',
    width: 150,
    sorter: (a, b) => a.cpsMoney - b.cpsMoney,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  },
  {
    title: '一口价',
    dataIndex: 'buyMoney',
    width: 150,
    sorter: (a, b) => a.buyMoney - b.buyMoney,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  },
  {
    title: '抖加',
    dataIndex: 'trillPremium',
    width: 150,
    sorter: (a, b) => a.trillPremium - b.trillPremium,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  },
  {
    title: '净流水',
    dataIndex: 'netWater',
    width: 150,
    sorter: (a, b) => a.netWater - b.netWater,
    customRender: (data) => {
      if (!data) return '￥0'
      return '￥' + safeDiv(data, 100)
    }
  }
]
export const douJiaColumn = {
  // 抖加运营投放list
  operatePutIn: [
    { title: '申请请款时间', dataIndex: 'createTime', width: 200 },
    { title: '大区', dataIndex: 'area', width: 150 },
    {
      title: '抖加投放费',
      width: 150,
      dataIndex: 'money',
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    },
    { title: '请款审核状态', width: 150, scopedSlots: { customRender: 'statusStr' } },
    { title: '已投放金额', width: 150, scopedSlots: { customRender: 'usedMoney' } },
    {
      title: '可投放余额',
      width: 150,
      scopedSlots: { customRender: 'availableMoney' }
    },
    { title: '投放产品数', width: 110, dataIndex: 'productNum' },
    { title: '投放主播数', width: 110, dataIndex: 'agentNum' },
    { title: '近期投放时间', width: 220, dataIndex: 'recentlyPutTime' },
    { title: '报销情况', width: 150, scopedSlots: { customRender: 'reimbursementStatusStr' } },
    {
      title: '报销审核中金额',
      width: 150,
      dataIndex: 'examineMoney',
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    },
    { title: '操作', width: 260, dataIndex: 'action', scopedSlots: { customRender: 'action' } }
  ],
  // 抖加运营投放list-detail
  operatePutInDetail: [
    {
      title: '报销状态',
      width: 100,
      dataIndex: 'status',
      scopedSlots: { customRender: 'status' }
    },
    { title: '站点', dataIndex: 'location', width: 120 },

    { title: '产品信息', width: 300, scopedSlots: { customRender: 'productId' } },
    { title: '作品信息', width: 300, scopedSlots: { customRender: 'videoId' } },
    { title: '投放信息', width: 300, scopedSlots: { customRender: 'putTime' } }
  ],
  // 抖加运营投放主播合作历史记录
  hostCooperaeHistory: [
    { title: '主播信息', dataIndex: 'id', width: 200, scopedSlots: { customRender: 'id' } },
    {
      title: '带货销量毛利',
      dataIndex: 'gross',
      width: 150,
      sorter: (a, b) => a.gross - b.gross,
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    },
    {
      title: '合作费用',
      dataIndex: 'cooperation',
      width: 150,
      sorter: (a, b) => a.cooperation - b.cooperation,
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    },
    {
      title: '抖加费用',
      dataIndex: 'douMoney',
      width: 150,
      sorter: (a, b) => a.douMoney - b.douMoney,
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    },
    {
      title: '利润',
      dataIndex: 'profit',
      width: 150,
      sorter: (a, b) => a.profit - b.profit,
      customRender: (data) => {
        if (!data) return '￥0'
        return '￥' + safeDiv(data, 100)
      }
    }
  ],
  // 运营数据看板--产品list
  dataBoardProduct: [
    { title: '产品信息', dataIndex: 'productId', width: 200, scopedSlots: { customRender: 'productId' } },
    { title: '站点区域', dataIndex: 'locationName', width: 200, scopedSlots: { customRender: 'locationName' } },
    ...columnForNum,
    ...columnForMoney1,
    {
      title: '带货主播数',
      dataIndex: 'productAgentNumber',
      width: 150,
      sorter: (a, b) => a.productAgentNumber - b.productAgentNumber
    },
    ...columnForMoney2,
    { title: '操作', width: 80, fixed: 'right', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
  ],
  // 运营数据看板--产品list-详情  /  运营数据看板--商家list-详情
  dataBoardProductDetail: [
    { title: '站点区域', dataIndex: 'locationId', width: 200, scopedSlots: { customRender: 'locationId' } },
    { title: '商品信息', dataIndex: 'productId', width: 200, scopedSlots: { customRender: 'productId' } },
    { title: '套餐信息', dataIndex: 'productitemName', width: 200 },
    ...columnForNum,
    ...columnForMoney1,
    {
      title: '探店主播数',
      dataIndex: 'productAgentNumber',
      width: 150,
      sorter: (a, b) => a.productAgentNumber - b.productAgentNumber
    },
    ...columnForMoney2,
    { title: '操作', width: 120, dataIndex: 'action', scopedSlots: { customRender: 'action' } }
  ],
  // 运营数据看板--产品list-详情--主播信息   /  运营数据看板--商家list-详情-主播信息
  dataBoardProductDetailHost: [{ title: '主播信息', dataIndex: 'agentId', width: 200, scopedSlots: { customRender: 'agentId' } }, ...columnForNum, ...columnForMoney1, ...columnForMoney2],
  // 运营数据看板--主播带货list
  dataBoardHost: [
    { title: '主播信息', dataIndex: 'agentId', width: 200, scopedSlots: { customRender: 'agentId' } },
    ...columnForNum,
    ...columnForMoney1,
    { title: '有效发片数量', dataIndex: 'pieceCount', width: 200, sorter: (a, b) => a.pieceCount - b.pieceCount },
    ...columnForMoney2,
    { title: '操作', width: 100, fixed: 'right', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
  ],
  // 运营数据看板--主播带货list-详情
  dataBoardHostDetail: [
    { title: '产品信息', dataIndex: 'productId', width: 200, scopedSlots: { customRender: 'productId' } },
    { title: '主播信息', dataIndex: 'agentId', width: 200, scopedSlots: { customRender: 'agentId' } },
    ...columnForNum,
    ...columnForMoney1,
    ...columnForMoney2
  ],
  dataBoardHostDetailProduct: [{ title: '套餐信息', dataIndex: 'productitemName', width: 200 }, ...columnForNum, ...columnForMoney1, ...columnForMoney2],
  // 运营数据看板--商家list
  dataBoardShop: [
    { title: '商家信息', dataIndex: 'businessName', width: 200, scopedSlots: { customRender: 'businessName' } },
    { title: '商家站点区域', dataIndex: 'configName', width: 200, scopedSlots: { customRender: 'configName' } },
    { title: '上线产品数', dataIndex: 'onlineProductNumber', width: 120 },
    ...columnForNum,
    ...columnForMoney1,
    { title: '探店主播数', dataIndex: 'productAgentNumber', width: 120, sorter: (a, b) => a.productAgentNumber - b.productAgentNumber },
    { title: '历史上线产品数', dataIndex: 'historyProductNumber', width: 200, sorter: (a, b) => a.historyProductNumber - b.historyProductNumber },
    ...columnForMoney2,
    { title: '操作', width: 100, fixed: 'right', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
  ]
}
